<?php

session_start();
include("load-settings.php");

if(!isset($_SESSION['user']))
	die;

$user = mysql_real_escape_string($_SESSION['user']);
$result = mysql_query("SELECT * FROM user WHERE id = $user") or die(mysql_error());
$row = mysql_fetch_array($result);

if($row['type'] != 2)
	die;

$order = mysql_real_escape_string($_POST['order']);

$message_array = explode(",", $order);

$x = 0;

while(isset($message_array[$x]))
{
	mysql_query("UPDATE email_notification SET defined_order = $x WHERE id = ".$message_array[$x]);
	$x++;
}

?>